﻿@model DCH.Areas.Admin.Models.Player

@{
    ViewBag.Title = "Edit";
}

<h2>Edit Player</h2>

@using (Html.BeginForm("edit","player",FormMethod.Post, new { enctype = "multipart/form-data" })){
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Player</legend>

        @Html.HiddenFor(model => model.ID)

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Role)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Role)
            @Html.ValidationMessageFor(model => model.Role)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Matches)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Matches)
            @Html.ValidationMessageFor(model => model.Matches)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.RunsOrWickets)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.RunsOrWickets)
            @Html.ValidationMessageFor(model => model.RunsOrWickets)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.TeamName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TeamName)
            @Html.ValidationMessageFor(model => model.TeamName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Stats)
        </div>
        <div class="editor-field">
             @Html.TextAreaFor(model => model.Stats, new { @class="ckeditor", @id="Stats"})
            @Html.ValidationMessageFor(model => model.Stats)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.highlight)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.highlight, new { @class="ckeditor", @id="highlight"})
            @Html.ValidationMessageFor(model => model.highlight)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.image)
        </div>
        <div class="editor-field">
            <input type="file" name="upload" id="file" style="width: 100%;" /> 
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
<script>

   
      var editor = CKEDITOR.instances["editor1"];
    if (editor) { editor.distroy(true); }
    CKEDITOR.replace("Stats", {
        enderMode: CKEDITOR.ENTER_BR,
    });
    CKEDITOR.replace("highlight", {
        enderMode: CKEDITOR.ENTER_BR,
    });
    CKFinder.setupCKEditor(null, '@Url.Content("~/ckfinder/")')
</script>
